// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie.characters.BodyDamage;

import java.nio.ByteBuffer;
import zombie.Lua.LuaEventManager;
import zombie.characterTextures.BloodBodyPartType;
import zombie.characters.IsoGameCharacter;
import zombie.characters.IsoPlayer;
import zombie.core.Rand;
import zombie.core.math.PZMath;
import zombie.inventory.types.Clothing;
import zombie.network.BodyDamageSync;

public final class BodyPart {
    BodyPartType Type;
    private float BiteDamage = 2.1875F;
    private float BleedDamage = 0.2857143F;
    private float DamageScaler = 0.0057142857F;
    private float Health;
    private boolean bandaged;
    private boolean bitten;
    private boolean bleeding;
    private boolean IsBleedingStemmed;
    private boolean IsCortorised;
    private boolean scratched;
    private boolean stitched;
    private boolean deepWounded;
    private boolean IsInfected;
    private boolean IsFakeInfected;
    private final IsoGameCharacter ParentChar;
    private float bandageLife = 0.0F;
    private float scratchTime = 0.0F;
    private float biteTime = 0.0F;
    private boolean alcoholicBandage = false;
    private float stiffness = 0.0F;
    private float woundInfectionLevel = 0.0F;
    private boolean infectedWound = false;
    private float ScratchDamage = 0.9375F;
    private float CutDamage = 1.875F;
    private float WoundDamage = 3.125F;
    private float BurnDamage = 3.75F;
    private float BulletDamage = 3.125F;
    private float FractureDamage = 3.125F;
    private float bleedingTime = 0.0F;
    private float deepWoundTime = 0.0F;
    private boolean haveGlass = false;
    private float stitchTime = 0.0F;
    private float alcoholLevel = 0.0F;
    private float additionalPain = 0.0F;
    private String bandageType = null;
    private boolean getBandageXp = true;
    private boolean getStitchXp = true;
    private boolean getSplintXp = true;
    private float fractureTime = 0.0F;
    private boolean splint = false;
    private float splintFactor = 0.0F;
    private boolean haveBullet = false;
    private float burnTime = 0.0F;
    private boolean needBurnWash = false;
    private float lastTimeBurnWash = 0.0F;
    private String splintItem = null;
    private float plantainFactor = 0.0F;
    private float comfreyFactor = 0.0F;
    private float garlicFactor = 0.0F;
    private float cutTime = 0.0F;
    private boolean cut = false;
    private float scratchSpeedModifier = 0.0F;
    private float cutSpeedModifier = 0.0F;
    private float burnSpeedModifier = 0.0F;
    private float deepWoundSpeedModifier = 0.0F;
    private float wetness = 0.0F;
    protected Thermoregulator.ThermalNode thermalNode;

    public BodyPart(BodyPartType ChosenType, IsoGameCharacter PC) {
        this.Type = ChosenType;
        this.ParentChar = PC;
        if (ChosenType == BodyPartType.Neck) {
            this.DamageScaler *= 5.0F;
        }

        if (ChosenType == BodyPartType.Hand_L
            || ChosenType == BodyPartType.Hand_R
            || ChosenType == BodyPartType.ForeArm_L
            || ChosenType == BodyPartType.ForeArm_R) {
            this.scratchSpeedModifier = 85.0F;
            this.cutSpeedModifier = 95.0F;
            this.burnSpeedModifier = 45.0F;
            this.deepWoundSpeedModifier = 60.0F;
        }

        if (ChosenType == BodyPartType.UpperArm_L || ChosenType == BodyPartType.UpperArm_R) {
            this.scratchSpeedModifier = 65.0F;
            this.cutSpeedModifier = 75.0F;
            this.burnSpeedModifier = 35.0F;
            this.deepWoundSpeedModifier = 40.0F;
        }

        if (ChosenType == BodyPartType.UpperLeg_L
            || ChosenType == BodyPartType.UpperLeg_R
            || ChosenType == BodyPartType.LowerLeg_L
            || ChosenType == BodyPartType.LowerLeg_R) {
            this.scratchSpeedModifier = 45.0F;
            this.cutSpeedModifier = 55.0F;
            this.burnSpeedModifier = 15.0F;
            this.deepWoundSpeedModifier = 20.0F;
        }

        if (ChosenType == BodyPartType.Foot_L || ChosenType == BodyPartType.Foot_R) {
            this.scratchSpeedModifier = 35.0F;
            this.cutSpeedModifier = 45.0F;
            this.burnSpeedModifier = 10.0F;
            this.deepWoundSpeedModifier = 15.0F;
        }

        if (ChosenType == BodyPartType.Groin) {
            this.scratchSpeedModifier = 45.0F;
            this.cutSpeedModifier = 55.0F;
            this.burnSpeedModifier = 15.0F;
            this.deepWoundSpeedModifier = 20.0F;
        }

        this.RestoreToFullHealth();
    }

    public void AddDamage(float Val) {
        this.Health -= Val;
        if (this.Health < 0.0F) {
            this.Health = 0.0F;
        }
    }

    public boolean isBandageDirty() {
        return this.getBandageLife() <= 0.0F;
    }

    public void DamageUpdate() {
        if (this.getDeepWoundTime() > 0.0F && !this.stitched()) {
            if (this.bandaged()) {
                this.Health = this.Health - this.WoundDamage / 2.0F * this.DamageScaler * zombie.GameTime.getInstance().getMultiplier();
            } else {
                this.Health = this.Health - this.WoundDamage * this.DamageScaler * zombie.GameTime.getInstance().getMultiplier();
            }
        }

        if (this.getScratchTime() > 0.0F && !this.bandaged()) {
            this.Health = this.Health - this.ScratchDamage * this.DamageScaler * zombie.GameTime.getInstance().getMultiplier();
        }

        if (this.getCutTime() > 0.0F && !this.bandaged()) {
            this.Health = this.Health - this.CutDamage * this.DamageScaler * zombie.GameTime.getInstance().getMultiplier();
        }

        if (this.getBiteTime() > 0.0F && !this.bandaged()) {
            this.Health = this.Health - this.BiteDamage * this.DamageScaler * zombie.GameTime.getInstance().getMultiplier();
        }

        if (this.getBleedingTime() > 0.0F && !this.bandaged()) {
            float _float = this.BleedDamage * this.DamageScaler * zombie.GameTime.getInstance().getMultiplier() * (this.getBleedingTime() / 10.0F);
            this.ParentChar.getBodyDamage().ReduceGeneralHealth(_float);
            LuaEventManager.triggerEvent("OnPlayerGetDamage", this.ParentChar, "BLEEDING", _float);
            if (Rand.NextBool(Rand.AdjustForFramerate(1000))) {
                this.ParentChar.addBlood(BloodBodyPartType.FromIndex(BodyPartType.ToIndex(this.getType())), false, false, true);
            }
        }

        if (this.haveBullet()) {
            if (this.bandaged()) {
                this.Health = this.Health - this.BulletDamage / 2.0F * this.DamageScaler * zombie.GameTime.getInstance().getMultiplier();
            } else {
                this.Health = this.Health - this.BulletDamage * this.DamageScaler * zombie.GameTime.getInstance().getMultiplier();
            }
        }

        if (this.getBurnTime() > 0.0F && !this.bandaged()) {
            this.Health = this.Health - this.BurnDamage * this.DamageScaler * zombie.GameTime.getInstance().getMultiplier();
        }

        if (this.getFractureTime() > 0.0F && !this.isSplint()) {
            this.Health = this.Health - this.FractureDamage * this.DamageScaler * zombie.GameTime.getInstance().getMultiplier();
        }

        if (this.getBiteTime() > 0.0F) {
            if (this.bandaged()) {
                this.setBiteTime(this.getBiteTime() - (float)(1.0E-4 * (double)zombie.GameTime.getInstance().getMultiplier()));
                this.setBandageLife(this.getBandageLife() - (float)(1.0E-4 * (double)zombie.GameTime.getInstance().getMultiplier()));
            } else {
                this.setBiteTime(this.getBiteTime() - (float)(5.0E-6 * (double)zombie.GameTime.getInstance().getMultiplier()));
            }
        }

        if (this.getBurnTime() > 0.0F) {
            if (this.bandaged()) {
                this.setBurnTime(this.getBurnTime() - (float)(1.0E-4 * (double)zombie.GameTime.getInstance().getMultiplier()));
                this.setBandageLife(this.getBandageLife() - (float)(1.0E-4 * (double)zombie.GameTime.getInstance().getMultiplier()));
            } else {
                this.setBurnTime(this.getBurnTime() - (float)(5.0E-6 * (double)zombie.GameTime.getInstance().getMultiplier()));
            }

            if (this.getLastTimeBurnWash() - this.getBurnTime() >= 20.0F) {
                this.setLastTimeBurnWash(0.0F);
                this.setNeedBurnWash(true);
            }
        }

        if (this.getBleedingTime() > 0.0F) {
            if (this.bandaged()) {
                this.setBleedingTime(this.getBleedingTime() - (float)(2.0E-4 * (double)zombie.GameTime.getInstance().getMultiplier()));
                if (this.getDeepWoundTime() > 0.0F) {
                    this.setBandageLife(this.getBandageLife() - (float)(0.005 * (double)zombie.GameTime.getInstance().getMultiplier()));
                } else {
                    this.setBandageLife(this.getBandageLife() - (float)(3.0E-4 * (double)zombie.GameTime.getInstance().getMultiplier()));
                }
            } else {
                this.setBleedingTime(this.getBleedingTime() - (float)(2.0E-5 * (double)zombie.GameTime.getInstance().getMultiplier()));
            }

            if (this.getBleedingTime() < 3.0F && this.haveGlass()) {
                this.setBleedingTime(3.0F);
            }

            if (this.getBleedingTime() < 0.0F) {
                this.setBleedingTime(0.0F);
                this.setBleeding(false);
            }
        }

        if (!this.isInfectedWound()
            && !this.IsInfected
            && (!this.alcoholicBandage || !(this.getBandageLife() > 0.0F))
            && (this.getDeepWoundTime() > 0.0F || this.getScratchTime() > 0.0F || this.getCutTime() > 0.0F || this.getStitchTime() > 0.0F)) {
            char _char = '\u9c40';
            if (!this.bandaged()) {
                _char -= 10000;
            } else if (this.getBandageLife() == 0.0F) {
                _char -= '\u88b8';
            }

            if (this.getScratchTime() > 0.0F) {
                _char -= 20000;
            }

            if (this.getCutTime() > 0.0F) {
                _char -= 25000;
            }

            if (this.getDeepWoundTime() > 0.0F) {
                _char -= 30000;
            }

            if (this.haveGlass()) {
                _char -= 24000;
            }

            if (this.getBurnTime() > 0.0F) {
                _char -= 23000;
                if (this.isNeedBurnWash()) {
                    _char -= 7000;
                }
            }

            if (BodyPartType.ToIndex(this.getType()) <= BodyPartType.ToIndex(BodyPartType.Torso_Lower)
                && this.ParentChar.getClothingItem_Torso() instanceof Clothing) {
                Clothing clothing0 = (Clothing)this.ParentChar.getClothingItem_Torso();
                if (clothing0.isDirty()) {
                    _char -= 20000;
                }

                if (clothing0.isBloody()) {
                    _char -= 24000;
                }
            }

            if (BodyPartType.ToIndex(this.getType()) >= BodyPartType.ToIndex(BodyPartType.UpperLeg_L)
                && BodyPartType.ToIndex(this.getType()) <= BodyPartType.ToIndex(BodyPartType.LowerLeg_R)
                && this.ParentChar.getClothingItem_Legs() instanceof Clothing) {
                Clothing clothing1 = (Clothing)this.ParentChar.getClothingItem_Legs();
                if (clothing1.isDirty()) {
                    _char -= 20000;
                }

                if (clothing1.isBloody()) {
                    _char -= 24000;
                }
            }

            if (_char <= 5000) {
                _char = 5000;
            }

            if (Rand.Next(Rand.AdjustForFramerate(_char)) == 0) {
                this.setInfectedWound(true);
            }
        } else if (this.isInfectedWound()) {
            boolean _boolean = false;
            if (this.getAlcoholLevel() > 0.0F) {
                this.setAlcoholLevel(this.getAlcoholLevel() - 2.0E-4F * zombie.GameTime.getInstance().getMultiplier());
                this.setWoundInfectionLevel(this.getWoundInfectionLevel() - 2.0E-4F * zombie.GameTime.getInstance().getMultiplier());
                if (this.getAlcoholLevel() < 0.0F) {
                    this.setAlcoholLevel(0.0F);
                }

                _boolean = true;
            }

            if (this.ParentChar.getReduceInfectionPower() > 0.0F) {
                this.setWoundInfectionLevel(this.getWoundInfectionLevel() - 2.0E-4F * zombie.GameTime.getInstance().getMultiplier());
                this.ParentChar.setReduceInfectionPower(this.ParentChar.getReduceInfectionPower() - 2.0E-4F * zombie.GameTime.getInstance().getMultiplier());
                if (this.ParentChar.getReduceInfectionPower() < 0.0F) {
                    this.ParentChar.setReduceInfectionPower(0.0F);
                }

                _boolean = true;
            }

            if (this.getGarlicFactor() > 0.0F) {
                this.setWoundInfectionLevel(this.getWoundInfectionLevel() - 2.0E-4F * zombie.GameTime.getInstance().getMultiplier());
                this.setGarlicFactor(this.getGarlicFactor() - 8.0E-4F * zombie.GameTime.getInstance().getMultiplier());
                _boolean = true;
            }

            if (!_boolean) {
                if (this.IsInfected) {
                    this.setWoundInfectionLevel(this.getWoundInfectionLevel() + 2.0E-4F * zombie.GameTime.getInstance().getMultiplier());
                } else if (this.haveGlass()) {
                    this.setWoundInfectionLevel(this.getWoundInfectionLevel() + 1.0E-4F * zombie.GameTime.getInstance().getMultiplier());
                } else {
                    this.setWoundInfectionLevel(this.getWoundInfectionLevel() + 1.0E-5F * zombie.GameTime.getInstance().getMultiplier());
                }

                if (this.getWoundInfectionLevel() > 10.0F) {
                    this.setWoundInfectionLevel(10.0F);
                }
            }
        }

        if (!this.isInfectedWound() && this.getAlcoholLevel() > 0.0F) {
            this.setAlcoholLevel(this.getAlcoholLevel() - 2.0E-4F * zombie.GameTime.getInstance().getMultiplier());
            if (this.getAlcoholLevel() < 0.0F) {
                this.setAlcoholLevel(0.0F);
            }
        }

        if (this.isInfectedWound() && this.getBandageLife() > 0.0F) {
            if (this.alcoholicBandage) {
                this.setWoundInfectionLevel(this.getWoundInfectionLevel() - 6.0E-4F * zombie.GameTime.getInstance().getMultiplier());
            }

            this.setBandageLife(this.getBandageLife() - (float)(2.0E-4 * (double)zombie.GameTime.getInstance().getMultiplier()));
        }

        if (this.getScratchTime() > 0.0F) {
            if (this.bandaged()) {
                this.setScratchTime(this.getScratchTime() - (float)(1.5E-4 * (double)zombie.GameTime.getInstance().getMultiplier()));
                this.setBandageLife(this.getBandageLife() - (float)(8.0E-5 * (double)zombie.GameTime.getInstance().getMultiplier()));
                if (this.getPlantainFactor() > 0.0F) {
                    this.setScratchTime(this.getScratchTime() - (float)(1.0E-4 * (double)zombie.GameTime.getInstance().getMultiplier()));
                    this.setPlantainFactor(this.getPlantainFactor() - (float)(8.0E-4 * (double)zombie.GameTime.getInstance().getMultiplier()));
                }
            } else {
                this.setScratchTime(this.getScratchTime() - (float)(1.0E-5 * (double)zombie.GameTime.getInstance().getMultiplier()));
            }

            if (this.getScratchTime() < 0.0F) {
                this.setScratchTime(0.0F);
                this.setGetBandageXp(true);
                this.setGetStitchXp(true);
                this.setScratched(false, false);
                this.setBleeding(false);
                this.setBleedingTime(0.0F);
            }
        }

        if (this.getCutTime() > 0.0F) {
            if (this.bandaged()) {
                this.setCutTime(this.getCutTime() - (float)(5.0E-5 * (double)zombie.GameTime.getInstance().getMultiplier()));
                this.setBandageLife(this.getBandageLife() - (float)(1.0E-5 * (double)zombie.GameTime.getInstance().getMultiplier()));
                if (this.getPlantainFactor() > 0.0F) {
                    this.setCutTime(this.getCutTime() - (float)(5.0E-5 * (double)zombie.GameTime.getInstance().getMultiplier()));
                    this.setPlantainFactor(this.getPlantainFactor() - (float)(8.0E-4 * (double)zombie.GameTime.getInstance().getMultiplier()));
                }
            } else {
                this.setCutTime(this.getCutTime() - (float)(1.0E-6 * (double)zombie.GameTime.getInstance().getMultiplier()));
            }

            if (this.getCutTime() < 0.0F) {
                this.setCutTime(0.0F);
                this.setGetBandageXp(true);
                this.setGetStitchXp(true);
                this.setBleeding(false);
                this.setBleedingTime(0.0F);
            }
        }

        if (this.getDeepWoundTime() > 0.0F) {
            if (this.bandaged()) {
                this.setDeepWoundTime(this.getDeepWoundTime() - (float)(2.0E-5 * (double)zombie.GameTime.getInstance().getMultiplier()));
                this.setBandageLife(this.getBandageLife() - (float)(1.0E-4 * (double)zombie.GameTime.getInstance().getMultiplier()));
                if (this.getPlantainFactor() > 0.0F) {
                    this.setDeepWoundTime(this.getDeepWoundTime() - (float)(7.0E-6 * (double)zombie.GameTime.getInstance().getMultiplier()));
                    this.setPlantainFactor(this.getPlantainFactor() - (float)(8.0E-4 * (double)zombie.GameTime.getInstance().getMultiplier()));
                    if (this.getPlantainFactor() < 0.0F) {
                        this.setPlantainFactor(0.0F);
                    }
                }
            } else {
                this.setDeepWoundTime(this.getDeepWoundTime() - (float)(2.0E-6 * (double)zombie.GameTime.getInstance().getMultiplier()));
            }

            if ((this.haveGlass() || !this.bandaged()) && this.getDeepWoundTime() < 3.0F) {
                this.setDeepWoundTime(3.0F);
            }

            if (this.getDeepWoundTime() < 0.0F) {
                this.setGetBandageXp(true);
                this.setGetStitchXp(true);
                this.setDeepWoundTime(0.0F);
                this.setDeepWounded(false);
            }
        }

        if (this.getStitchTime() > 0.0F && this.getStitchTime() < 50.0F) {
            if (this.bandaged()) {
                this.setStitchTime(this.getStitchTime() + (float)(4.0E-4 * (double)zombie.GameTime.getInstance().getMultiplier()));
                this.setBandageLife(this.getBandageLife() - (float)(1.0E-4 * (double)zombie.GameTime.getInstance().getMultiplier()));
                if (!this.alcoholicBandage && Rand.Next(Rand.AdjustForFramerate(80000)) == 0) {
                    this.setInfectedWound(true);
                }

                this.setStitchTime(this.getStitchTime() + (float)(1.0E-4 * (double)zombie.GameTime.getInstance().getMultiplier()));
            } else {
                this.setStitchTime(this.getStitchTime() + (float)(2.0E-4 * (double)zombie.GameTime.getInstance().getMultiplier()));
                if (Rand.Next(Rand.AdjustForFramerate(20000)) == 0) {
                    this.setInfectedWound(true);
                }
            }

            if (this.getStitchTime() > 30.0F) {
                this.setGetStitchXp(true);
            }

            if (this.getStitchTime() > 50.0F) {
                this.setStitchTime(50.0F);
            }
        }

        if (this.getFractureTime() > 0.0F) {
            if (this.getSplintFactor() > 0.0F) {
                this.setFractureTime(
                    this.getFractureTime() - (float)(5.0E-5 * (double)zombie.GameTime.getInstance().getMultiplier() * (double)this.getSplintFactor())
                );
            } else {
                this.setFractureTime(this.getFractureTime() - (float)(5.0E-6 * (double)zombie.GameTime.getInstance().getMultiplier()));
            }

            if (this.getComfreyFactor() > 0.0F) {
                this.setFractureTime(this.getFractureTime() - (float)(5.0E-6 * (double)zombie.GameTime.getInstance().getMultiplier()));
                this.setComfreyFactor(this.getComfreyFactor() - (float)(5.0E-4 * (double)zombie.GameTime.getInstance().getMultiplier()));
            }

            if (this.getFractureTime() < 0.0F) {
                this.setFractureTime(0.0F);
                this.setGetSplintXp(true);
            }
        }

        if (this.getAdditionalPain() > 0.0F) {
            this.setAdditionalPain(this.getAdditionalPain() - (float)(0.005 * (double)zombie.GameTime.getInstance().getMultiplier()));
            if (this.getAdditionalPain() < 0.0F) {
                this.setAdditionalPain(0.0F);
            }
        }

        if (this.getStiffness() > 0.0F
            && this.ParentChar instanceof IsoPlayer
            && ((IsoPlayer)this.ParentChar).getFitness() != null
            && !((IsoPlayer)this.ParentChar).getFitness().onGoingStiffness()) {
            this.setStiffness(this.getStiffness() - (float)(0.002 * (double)zombie.GameTime.getInstance().getMultiplier()));
            if (this.getStiffness() < 0.0F) {
                this.setStiffness(0.0F);
            }
        }

        if (this.getBandageLife() < 0.0F) {
            this.setBandageLife(0.0F);
            this.setGetBandageXp(true);
        }

        if ((this.getWoundInfectionLevel() > 0.0F || this.isInfectedWound())
            && this.getBurnTime() <= 0.0F
            && this.getFractureTime() <= 0.0F
            && this.getDeepWoundTime() <= 0.0F
            && this.getScratchTime() <= 0.0F
            && this.getBiteTime() <= 0.0F
            && this.getCutTime() <= 0.0F
            && this.getStitchTime() <= 0.0F) {
            this.setWoundInfectionLevel(0.0F);
        }

        if (this.Health < 0.0F) {
            this.Health = 0.0F;
        }
    }

    public float getHealth() {
        return this.Health;
    }

    public void SetHealth(float NewHealth) {
        this.Health = NewHealth;
    }

    public void AddHealth(float Val) {
        this.Health += Val;
        if (this.Health > 100.0F) {
            this.Health = 100.0F;
        }
    }

    public void ReduceHealth(float Val) {
        this.Health -= Val;
        if (this.Health < 0.0F) {
            this.Health = 0.0F;
        }
    }

    public boolean HasInjury() {
        return this.bitten
            | this.scratched
            | this.deepWounded
            | this.bleeding
            | this.getBiteTime() > 0.0F
            | this.getScratchTime() > 0.0F
            | this.getCutTime() > 0.0F
            | this.getFractureTime() > 0.0F
            | this.haveBullet()
            | this.getBurnTime() > 0.0F;
    }

    public boolean bandaged() {
        return this.bandaged;
    }

    public boolean bitten() {
        return this.bitten;
    }

    public boolean bleeding() {
        return this.bleeding;
    }

    public boolean IsBleedingStemmed() {
        return this.IsBleedingStemmed;
    }

    public boolean IsCortorised() {
        return this.IsCortorised;
    }

    public boolean IsInfected() {
        return this.IsInfected;
    }

    public void SetInfected(boolean inf) {
        this.IsInfected = inf;
    }

    public void SetFakeInfected(boolean inf) {
        this.IsFakeInfected = inf;
    }

    public boolean IsFakeInfected() {
        return this.IsFakeInfected;
    }

    public void DisableFakeInfection() {
        this.IsFakeInfected = false;
    }

    public boolean scratched() {
        return this.scratched;
    }

    public boolean stitched() {
        return this.stitched;
    }

    public boolean deepWounded() {
        return this.deepWounded;
    }

    public void RestoreToFullHealth() {
        this.Health = 100.0F;
        this.additionalPain = 0.0F;
        this.alcoholicBandage = false;
        this.alcoholLevel = 0.0F;
        this.bleeding = false;
        this.bandaged = false;
        this.bandageLife = 0.0F;
        this.biteTime = 0.0F;
        this.bitten = false;
        this.bleedingTime = 0.0F;
        this.burnTime = 0.0F;
        this.comfreyFactor = 0.0F;
        this.deepWounded = false;
        this.deepWoundTime = 0.0F;
        this.fractureTime = 0.0F;
        this.garlicFactor = 0.0F;
        this.haveBullet = false;
        this.haveGlass = false;
        this.infectedWound = false;
        this.IsBleedingStemmed = false;
        this.IsCortorised = false;
        this.IsFakeInfected = false;
        this.IsInfected = false;
        this.lastTimeBurnWash = 0.0F;
        this.needBurnWash = false;
        this.plantainFactor = 0.0F;
        this.scratched = false;
        this.scratchTime = 0.0F;
        this.splint = false;
        this.splintFactor = 0.0F;
        this.splintItem = null;
        this.stitched = false;
        this.stitchTime = 0.0F;
        this.woundInfectionLevel = 0.0F;
        this.cutTime = 0.0F;
        this.cut = false;
    }

    public void setBandaged(boolean Bandaged, float _bandageLife) {
        this.setBandaged(Bandaged, _bandageLife, false, null);
    }

    public void setBandaged(boolean Bandaged, float _bandageLife, boolean isAlcoholic, String _bandageType) {
        if (Bandaged) {
            if (this.bleeding) {
                this.bleeding = false;
            }

            this.bitten = false;
            this.scratched = false;
            this.cut = false;
            this.alcoholicBandage = isAlcoholic;
            this.stitched = false;
            this.deepWounded = false;
            this.setBandageType(_bandageType);
            this.setGetBandageXp(false);
        } else {
            if (this.getScratchTime() > 0.0F) {
                this.scratched = true;
            }

            if (this.getCutTime() > 0.0F) {
                this.cut = true;
            }

            if (this.getBleedingTime() > 0.0F) {
                this.bleeding = true;
            }

            if (this.getBiteTime() > 0.0F) {
                this.bitten = true;
            }

            if (this.getStitchTime() > 0.0F) {
                this.stitched = true;
            }

            if (this.getDeepWoundTime() > 0.0F) {
                this.deepWounded = true;
            }
        }

        this.setBandageLife(_bandageLife);
        this.bandaged = Bandaged;
    }

    public void SetBitten(boolean Bitten) {
        this.bitten = Bitten;
        if (Bitten) {
            this.bleeding = true;
            this.IsBleedingStemmed = false;
            this.IsCortorised = false;
            this.bandaged = false;
            this.setInfectedWound(true);
            this.setBiteTime(Rand.Next(50.0F, 80.0F));
            if (this.ParentChar.Traits.FastHealer.isSet()) {
                this.setBiteTime(Rand.Next(30.0F, 50.0F));
            }

            if (this.ParentChar.Traits.SlowHealer.isSet()) {
                this.setBiteTime(Rand.Next(80.0F, 150.0F));
            }
        }

        if (zombie.SandboxOptions.instance.Lore.Transmission.getValue() != 4) {
            this.IsInfected = true;
            this.IsFakeInfected = false;
        }

        if (this.IsInfected && zombie.SandboxOptions.instance.Lore.Mortality.getValue() == 7) {
            this.IsInfected = false;
            this.IsFakeInfected = true;
        }

        this.generateBleeding();
    }

    public void SetBitten(boolean Bitten, boolean Infected) {
        this.bitten = Bitten;
        if (zombie.SandboxOptions.instance.Lore.Transmission.getValue() == 4) {
            this.IsInfected = false;
            this.IsFakeInfected = false;
            Infected = false;
        }

        if (Bitten) {
            this.bleeding = true;
            this.IsBleedingStemmed = false;
            this.IsCortorised = false;
            this.bandaged = false;
            if (Infected) {
                this.IsInfected = true;
            }

            this.IsFakeInfected = false;
            if (this.IsInfected && zombie.SandboxOptions.instance.Lore.Mortality.getValue() == 7) {
                this.IsInfected = false;
                this.IsFakeInfected = true;
            }
        }
    }

    public void setBleeding(boolean Bleeding) {
        this.bleeding = Bleeding;
    }

    public void SetBleedingStemmed(boolean BleedingStemmed) {
        if (this.bleeding) {
            this.bleeding = false;
            this.IsBleedingStemmed = true;
        }
    }

    public void SetCortorised(boolean Cortorised) {
        this.IsCortorised = Cortorised;
        if (Cortorised) {
            this.bleeding = false;
            this.IsBleedingStemmed = false;
            this.deepWounded = false;
            this.bandaged = false;
        }
    }

    public void setCut(boolean _cut) {
        this.setCut(_cut, true);
    }

    public void setCut(boolean _cut, boolean forceNoInfection) {
        this.cut = _cut;
        if (_cut) {
            this.setStitched(false);
            this.setBandaged(false, 0.0F);
            float _float = Rand.Next(10.0F, 20.0F);
            if (this.ParentChar.Traits.FastHealer.isSet()) {
                _float = Rand.Next(5.0F, 10.0F);
            }

            if (this.ParentChar.Traits.SlowHealer.isSet()) {
                _float = Rand.Next(20.0F, 30.0F);
            }

            switch (zombie.SandboxOptions.instance.InjurySeverity.getValue()) {
                case 1:
                    _float *= 0.5F;
                    break;
                case 3:
                    _float *= 1.5F;
            }

            this.setCutTime(_float);
            this.generateBleeding();
            if (!forceNoInfection) {
                this.generateZombieInfection(25);
            }
        } else {
            this.setBleeding(false);
        }
    }

    public void generateZombieInfection(int baseChance) {
        if (Rand.Next(100) < baseChance) {
            this.IsInfected = true;
        }

        if (!this.IsInfected && this.ParentChar.Traits.Hypercondriac.isSet() && Rand.Next(100) < 80) {
            this.IsFakeInfected = true;
        }

        if (zombie.SandboxOptions.instance.Lore.Transmission.getValue() == 2 || zombie.SandboxOptions.instance.Lore.Transmission.getValue() == 4) {
            this.IsInfected = false;
            this.IsFakeInfected = false;
        }

        if (this.IsInfected && zombie.SandboxOptions.instance.Lore.Mortality.getValue() == 7) {
            this.IsInfected = false;
            this.IsFakeInfected = true;
        }
    }

    public void setScratched(boolean Scratched, boolean forceNoInfection) {
        this.scratched = Scratched;
        if (Scratched) {
            this.setStitched(false);
            this.setBandaged(false, 0.0F);
            float _float = Rand.Next(7.0F, 15.0F);
            if (this.ParentChar.Traits.FastHealer.isSet()) {
                _float = Rand.Next(4.0F, 10.0F);
            }

            if (this.ParentChar.Traits.SlowHealer.isSet()) {
                _float = Rand.Next(15.0F, 25.0F);
            }

            switch (zombie.SandboxOptions.instance.InjurySeverity.getValue()) {
                case 1:
                    this.scratchTime *= 0.5F;
                    break;
                case 3:
                    this.scratchTime *= 1.5F;
            }

            this.setScratchTime(_float);
            this.generateBleeding();
            if (!forceNoInfection) {
                this.generateZombieInfection(7);
            }
        } else {
            this.setBleeding(false);
        }
    }

    public void SetScratchedWeapon(boolean Scratched) {
        this.scratched = Scratched;
        if (Scratched) {
            this.setStitched(false);
            this.setBandaged(false, 0.0F);
            float _float = Rand.Next(5.0F, 10.0F);
            if (this.ParentChar.Traits.FastHealer.isSet()) {
                _float = Rand.Next(1.0F, 5.0F);
            }

            if (this.ParentChar.Traits.SlowHealer.isSet()) {
                _float = Rand.Next(10.0F, 20.0F);
            }

            switch (zombie.SandboxOptions.instance.InjurySeverity.getValue()) {
                case 1:
                    this.scratchTime *= 0.5F;
                    break;
                case 3:
                    this.scratchTime *= 1.5F;
            }

            this.setScratchTime(_float);
            this.generateBleeding();
        }
    }

    public void generateDeepWound() {
        float _float = Rand.Next(15.0F, 20.0F);
        if (this.ParentChar.Traits.FastHealer.isSet()) {
            _float = Rand.Next(11.0F, 15.0F);
        } else if (this.ParentChar.Traits.SlowHealer.isSet()) {
            _float = Rand.Next(20.0F, 32.0F);
        }

        switch (zombie.SandboxOptions.instance.InjurySeverity.getValue()) {
            case 1:
                _float *= 0.5F;
                break;
            case 3:
                _float *= 1.5F;
        }

        this.setDeepWoundTime(_float);
        this.setDeepWounded(true);
        this.generateBleeding();
    }

    public void generateDeepShardWound() {
        float _float = Rand.Next(15.0F, 20.0F);
        if (this.ParentChar.Traits.FastHealer.isSet()) {
            _float = Rand.Next(11.0F, 15.0F);
        } else if (this.ParentChar.Traits.SlowHealer.isSet()) {
            _float = Rand.Next(20.0F, 32.0F);
        }

        switch (zombie.SandboxOptions.instance.InjurySeverity.getValue()) {
            case 1:
                _float *= 0.5F;
                break;
            case 3:
                _float *= 1.5F;
        }

        this.setDeepWoundTime(_float);
        this.setHaveGlass(true);
        this.setDeepWounded(true);
        this.generateBleeding();
    }

    public void SetScratchedWindow(boolean Scratched) {
        if (Scratched) {
            this.setBandaged(false, 0.0F);
            this.setStitched(false);
            if (Rand.Next(7) == 0) {
                this.generateDeepShardWound();
            } else {
                this.scratched = Scratched;
                float _float = Rand.Next(12.0F, 20.0F);
                if (this.ParentChar.Traits.FastHealer.isSet()) {
                    _float = Rand.Next(5.0F, 10.0F);
                }

                if (this.ParentChar.Traits.SlowHealer.isSet()) {
                    _float = Rand.Next(20.0F, 30.0F);
                }

                switch (zombie.SandboxOptions.instance.InjurySeverity.getValue()) {
                    case 1:
                        this.scratchTime *= 0.5F;
                        break;
                    case 3:
                        this.scratchTime *= 1.5F;
                }

                this.setScratchTime(_float);
            }

            this.generateBleeding();
        }
    }

    public void setStitched(boolean Stitched) {
        if (Stitched) {
            this.setBleedingTime(0.0F);
            this.setBleeding(false);
            this.setDeepWoundTime(0.0F);
            this.setDeepWounded(false);
            this.setGetStitchXp(false);
        } else if (this.stitched) {
            this.stitched = false;
            if (this.getStitchTime() < 40.0F) {
                this.setDeepWoundTime(Rand.Next(10.0F, this.getStitchTime()));
                this.setBleedingTime(Rand.Next(10.0F, this.getStitchTime()));
                this.setStitchTime(0.0F);
                this.setDeepWounded(true);
            } else {
                this.setScratchTime(Rand.Next(2.0F, this.getStitchTime() - 40.0F));
                this.scratched = true;
                this.setStitchTime(0.0F);
            }
        }

        this.stitched = Stitched;
    }

    public void damageFromFirearm(float damage) {
        this.setHaveBullet(true, 0);
    }

    public float getPain() {
        float _float = 0.0F;
        if (this.getScratchTime() > 0.0F) {
            _float += this.getScratchTime() * 1.7F;
        }

        if (this.getCutTime() > 0.0F) {
            _float += this.getCutTime() * 2.5F;
        }

        if (this.getBiteTime() > 0.0F) {
            if (this.bandaged()) {
                _float += 30.0F;
            } else if (!this.bandaged()) {
                _float += 50.0F;
            }
        }

        if (this.getDeepWoundTime() > 0.0F) {
            _float += this.getDeepWoundTime() * 3.7F;
        }

        if (this.getStitchTime() > 0.0F && this.getStitchTime() < 35.0F) {
            if (this.bandaged()) {
                _float += (35.0F - this.getStitchTime()) / 2.0F;
            } else {
                _float += 35.0F - this.getStitchTime();
            }
        }

        if (this.getFractureTime() > 0.0F) {
            if (this.getSplintFactor() > 0.0F) {
                _float += this.getFractureTime() / 2.0F;
            } else {
                _float += this.getFractureTime();
            }
        }

        if (this.haveBullet()) {
            _float += 50.0F;
        }

        if (this.haveGlass()) {
            _float += 10.0F;
        }

        if (this.getBurnTime() > 0.0F) {
            _float += this.getBurnTime();
        }

        if (this.bandaged()) {
            _float /= 1.5F;
        }

        if (this.getWoundInfectionLevel() > 0.0F) {
            _float += this.getWoundInfectionLevel();
        }

        _float += this.getAdditionalPain(true);
        switch (zombie.SandboxOptions.instance.InjurySeverity.getValue()) {
            case 1:
                _float *= 0.7F;
                break;
            case 3:
                _float *= 1.3F;
        }

        return _float;
    }

    public float getBiteTime() {
        return this.biteTime;
    }

    public void setBiteTime(float _biteTime) {
        this.biteTime = _biteTime;
    }

    public float getDeepWoundTime() {
        return this.deepWoundTime;
    }

    public void setDeepWoundTime(float _deepWoundTime) {
        this.deepWoundTime = _deepWoundTime;
    }

    public boolean haveGlass() {
        return this.haveGlass;
    }

    public void setHaveGlass(boolean _haveGlass) {
        this.haveGlass = _haveGlass;
    }

    public float getStitchTime() {
        return this.stitchTime;
    }

    public void setStitchTime(float _stitchTime) {
        this.stitchTime = _stitchTime;
    }

    public int getIndex() {
        return BodyPartType.ToIndex(this.Type);
    }

    public float getAlcoholLevel() {
        return this.alcoholLevel;
    }

    public void setAlcoholLevel(float _alcoholLevel) {
        this.alcoholLevel = _alcoholLevel;
    }

    public float getAdditionalPain(boolean includeStiffness) {
        return includeStiffness ? this.additionalPain + this.stiffness / 3.5F : this.additionalPain;
    }

    public float getAdditionalPain() {
        return this.additionalPain;
    }

    public void setAdditionalPain(float _additionalPain) {
        this.additionalPain = _additionalPain;
    }

    public String getBandageType() {
        return this.bandageType;
    }

    public void setBandageType(String _bandageType) {
        this.bandageType = _bandageType;
    }

    public boolean isGetBandageXp() {
        return this.getBandageXp;
    }

    public void setGetBandageXp(boolean _getBandageXp) {
        this.getBandageXp = _getBandageXp;
    }

    public boolean isGetStitchXp() {
        return this.getStitchXp;
    }

    public void setGetStitchXp(boolean _getStitchXp) {
        this.getStitchXp = _getStitchXp;
    }

    public float getSplintFactor() {
        return this.splintFactor;
    }

    public void setSplintFactor(float _splintFactor) {
        this.splintFactor = _splintFactor;
    }

    public float getFractureTime() {
        return this.fractureTime;
    }

    public void setFractureTime(float _fractureTime) {
        this.fractureTime = _fractureTime;
    }

    public boolean isGetSplintXp() {
        return this.getSplintXp;
    }

    public void setGetSplintXp(boolean _getSplintXp) {
        this.getSplintXp = _getSplintXp;
    }

    public boolean isSplint() {
        return this.splint;
    }

    public void setSplint(boolean _splint, float _splintFactor) {
        this.splint = _splint;
        this.setSplintFactor(_splintFactor);
        if (_splint) {
            this.setGetSplintXp(false);
        }
    }

    public boolean haveBullet() {
        return this.haveBullet;
    }

    public void setHaveBullet(boolean _haveBullet, int doctorLevel) {
        if (this.haveBullet && !_haveBullet) {
            float _float = Rand.Next(17.0F, 23.0F) - (float)(doctorLevel / 2);
            if (this.ParentChar != null && this.ParentChar.Traits != null) {
                if (this.ParentChar.Traits.FastHealer.isSet()) {
                    _float = Rand.Next(12.0F, 18.0F) - (float)(doctorLevel / 2);
                } else if (this.ParentChar.Traits.SlowHealer.isSet()) {
                    _float = Rand.Next(22.0F, 28.0F) - (float)(doctorLevel / 2);
                }
            }

            switch (zombie.SandboxOptions.instance.InjurySeverity.getValue()) {
                case 1:
                    _float *= 0.5F;
                    break;
                case 3:
                    _float *= 1.5F;
            }

            this.setDeepWoundTime(_float);
            this.setDeepWounded(true);
            this.haveBullet = false;
            this.generateBleeding();
        } else if (_haveBullet) {
            this.haveBullet = true;
            this.generateBleeding();
        }

        this.haveBullet = _haveBullet;
    }

    public float getBurnTime() {
        return this.burnTime;
    }

    public void setBurnTime(float _burnTime) {
        this.burnTime = _burnTime;
    }

    public boolean isNeedBurnWash() {
        return this.needBurnWash;
    }

    public void setNeedBurnWash(boolean _needBurnWash) {
        if (this.needBurnWash && !_needBurnWash) {
            this.setLastTimeBurnWash(this.getBurnTime());
        }

        this.needBurnWash = _needBurnWash;
    }

    public float getLastTimeBurnWash() {
        return this.lastTimeBurnWash;
    }

    public void setLastTimeBurnWash(float _lastTimeBurnWash) {
        this.lastTimeBurnWash = _lastTimeBurnWash;
    }

    public boolean isInfectedWound() {
        return this.infectedWound;
    }

    public void setInfectedWound(boolean _infectedWound) {
        this.infectedWound = _infectedWound;
    }

    public BodyPartType getType() {
        return this.Type;
    }

    public float getBleedingTime() {
        return this.bleedingTime;
    }

    public void setBleedingTime(float _bleedingTime) {
        this.bleedingTime = _bleedingTime;
        if (!this.bandaged()) {
            this.setBleeding(_bleedingTime > 0.0F);
        }
    }

    public boolean isDeepWounded() {
        return this.deepWounded;
    }

    public void setDeepWounded(boolean Wounded) {
        this.deepWounded = Wounded;
        if (Wounded) {
            this.bleeding = true;
            this.IsBleedingStemmed = false;
            this.IsCortorised = false;
            this.bandaged = false;
            this.stitched = false;
        }
    }

    public float getBandageLife() {
        return this.bandageLife;
    }

    public void setBandageLife(float _bandageLife) {
        this.bandageLife = _bandageLife;
        if (this.bandageLife <= 0.0F) {
            this.alcoholicBandage = false;
        }
    }

    public float getScratchTime() {
        return this.scratchTime;
    }

    public void setScratchTime(float _scratchTime) {
        _scratchTime = Math.min(100.0F, _scratchTime);
        this.scratchTime = _scratchTime;
    }

    public float getWoundInfectionLevel() {
        return this.woundInfectionLevel;
    }

    public void setWoundInfectionLevel(float _infectedWound) {
        this.woundInfectionLevel = _infectedWound;
        if (this.woundInfectionLevel <= 0.0F) {
            this.setInfectedWound(false);
            if (this.woundInfectionLevel < -2.0F) {
                this.woundInfectionLevel = -2.0F;
            }
        } else {
            this.setInfectedWound(true);
        }
    }

    public void setBurned() {
        float _float = Rand.Next(50.0F, 100.0F);
        switch (zombie.SandboxOptions.instance.InjurySeverity.getValue()) {
            case 1:
                _float *= 0.5F;
                break;
            case 3:
                _float *= 1.5F;
        }

        this.setBurnTime(_float);
        this.setNeedBurnWash(true);
        this.setLastTimeBurnWash(0.0F);
    }

    public String getSplintItem() {
        return this.splintItem;
    }

    public void setSplintItem(String _splintItem) {
        this.splintItem = _splintItem;
    }

    public float getPlantainFactor() {
        return this.plantainFactor;
    }

    public void setPlantainFactor(float _plantainFactor) {
        this.plantainFactor = PZMath.clamp(_plantainFactor, 0.0F, 100.0F);
    }

    public float getGarlicFactor() {
        return this.garlicFactor;
    }

    public void setGarlicFactor(float _garlicFactor) {
        this.garlicFactor = PZMath.clamp(_garlicFactor, 0.0F, 100.0F);
    }

    public float getComfreyFactor() {
        return this.comfreyFactor;
    }

    public void setComfreyFactor(float _comfreyFactor) {
        this.comfreyFactor = PZMath.clamp(_comfreyFactor, 0.0F, 100.0F);
    }

    public void sync(BodyPart other, BodyDamageSync.Updater updater) {
        if (updater.updateField((byte)1, this.Health, other.Health)) {
            other.Health = this.Health;
        }

        if (this.bandaged != other.bandaged) {
            updater.updateField((byte)2, this.bandaged);
            other.bandaged = this.bandaged;
        }

        if (this.bitten != other.bitten) {
            updater.updateField((byte)3, this.bitten);
            other.bitten = this.bitten;
        }

        if (this.bleeding != other.bleeding) {
            updater.updateField((byte)4, this.bleeding);
            other.bleeding = this.bleeding;
        }

        if (this.IsBleedingStemmed != other.IsBleedingStemmed) {
            updater.updateField((byte)5, this.IsBleedingStemmed);
            other.IsBleedingStemmed = this.IsBleedingStemmed;
        }

        if (this.scratched != other.scratched) {
            updater.updateField((byte)7, this.scratched);
            other.scratched = this.scratched;
        }

        if (this.cut != other.cut) {
            updater.updateField((byte)39, this.cut);
            other.cut = this.cut;
        }

        if (this.stitched != other.stitched) {
            updater.updateField((byte)8, this.stitched);
            other.stitched = this.stitched;
        }

        if (this.deepWounded != other.deepWounded) {
            updater.updateField((byte)9, this.deepWounded);
            other.deepWounded = this.deepWounded;
        }

        if (this.IsInfected != other.IsInfected) {
            updater.updateField((byte)10, this.IsInfected);
            other.IsInfected = this.IsInfected;
        }

        if (this.IsFakeInfected != other.IsFakeInfected) {
            updater.updateField((byte)11, this.IsFakeInfected);
            other.IsFakeInfected = this.IsFakeInfected;
        }

        if (updater.updateField((byte)12, this.bandageLife, other.bandageLife)) {
            other.bandageLife = this.bandageLife;
        }

        if (updater.updateField((byte)13, this.scratchTime, other.scratchTime)) {
            other.scratchTime = this.scratchTime;
        }

        if (updater.updateField((byte)14, this.biteTime, other.biteTime)) {
            other.biteTime = this.biteTime;
        }

        if (this.alcoholicBandage != other.alcoholicBandage) {
            updater.updateField((byte)15, this.alcoholicBandage);
            other.alcoholicBandage = this.alcoholicBandage;
        }

        if (updater.updateField((byte)16, this.woundInfectionLevel, other.woundInfectionLevel)) {
            other.woundInfectionLevel = this.woundInfectionLevel;
        }

        if (updater.updateField((byte)41, this.stiffness, other.stiffness)) {
            other.stiffness = this.stiffness;
        }

        if (this.infectedWound != other.infectedWound) {
            updater.updateField((byte)17, this.infectedWound);
            other.infectedWound = this.infectedWound;
        }

        if (updater.updateField((byte)18, this.bleedingTime, other.bleedingTime)) {
            other.bleedingTime = this.bleedingTime;
        }

        if (updater.updateField((byte)19, this.deepWoundTime, other.deepWoundTime)) {
            other.deepWoundTime = this.deepWoundTime;
        }

        if (updater.updateField((byte)40, this.cutTime, other.cutTime)) {
            other.cutTime = this.cutTime;
        }

        if (this.haveGlass != other.haveGlass) {
            updater.updateField((byte)20, this.haveGlass);
            other.haveGlass = this.haveGlass;
        }

        if (updater.updateField((byte)21, this.stitchTime, other.stitchTime)) {
            other.stitchTime = this.stitchTime;
        }

        if (updater.updateField((byte)22, this.alcoholLevel, other.alcoholLevel)) {
            other.alcoholLevel = this.alcoholLevel;
        }

        if (updater.updateField((byte)23, this.additionalPain, other.additionalPain)) {
            other.additionalPain = this.additionalPain;
        }

        if (this.bandageType != other.bandageType) {
            updater.updateField((byte)24, this.bandageType);
            other.bandageType = this.bandageType;
        }

        if (this.getBandageXp != other.getBandageXp) {
            updater.updateField((byte)25, this.getBandageXp);
            other.getBandageXp = this.getBandageXp;
        }

        if (this.getStitchXp != other.getStitchXp) {
            updater.updateField((byte)26, this.getStitchXp);
            other.getStitchXp = this.getStitchXp;
        }

        if (this.getSplintXp != other.getSplintXp) {
            updater.updateField((byte)27, this.getSplintXp);
            other.getSplintXp = this.getSplintXp;
        }

        if (updater.updateField((byte)28, this.fractureTime, other.fractureTime)) {
            other.fractureTime = this.fractureTime;
        }

        if (this.splint != other.splint) {
            updater.updateField((byte)29, this.splint);
            other.splint = this.splint;
        }

        if (updater.updateField((byte)30, this.splintFactor, other.splintFactor)) {
            other.splintFactor = this.splintFactor;
        }

        if (this.haveBullet != other.haveBullet) {
            updater.updateField((byte)31, this.haveBullet);
            other.haveBullet = this.haveBullet;
        }

        if (updater.updateField((byte)32, this.burnTime, other.burnTime)) {
            other.burnTime = this.burnTime;
        }

        if (this.needBurnWash != other.needBurnWash) {
            updater.updateField((byte)33, this.needBurnWash);
            other.needBurnWash = this.needBurnWash;
        }

        if (updater.updateField((byte)34, this.lastTimeBurnWash, other.lastTimeBurnWash)) {
            other.lastTimeBurnWash = this.lastTimeBurnWash;
        }

        if (this.splintItem != other.splintItem) {
            updater.updateField((byte)35, this.splintItem);
            other.splintItem = this.splintItem;
        }

        if (updater.updateField((byte)36, this.plantainFactor, other.plantainFactor)) {
            other.plantainFactor = this.plantainFactor;
        }

        if (updater.updateField((byte)37, this.comfreyFactor, other.comfreyFactor)) {
            other.comfreyFactor = this.comfreyFactor;
        }

        if (updater.updateField((byte)38, this.garlicFactor, other.garlicFactor)) {
            other.garlicFactor = this.garlicFactor;
        }
    }

    public void sync(ByteBuffer bb, byte id) {
        switch (id) {
            case 1:
                this.Health = bb.getFloat();
                break;
            case 2:
                this.bandaged = bb.get() == 1;
                break;
            case 3:
                this.bitten = bb.get() == 1;
                break;
            case 4:
                this.bleeding = bb.get() == 1;
                break;
            case 5:
                this.IsBleedingStemmed = bb.get() == 1;
                break;
            case 6:
                this.IsCortorised = bb.get() == 1;
                break;
            case 7:
                this.scratched = bb.get() == 1;
                break;
            case 8:
                this.stitched = bb.get() == 1;
                break;
            case 9:
                this.deepWounded = bb.get() == 1;
                break;
            case 10:
                this.IsInfected = bb.get() == 1;
                break;
            case 11:
                this.IsFakeInfected = bb.get() == 1;
                break;
            case 12:
                this.bandageLife = bb.getFloat();
                break;
            case 13:
                this.scratchTime = bb.getFloat();
                break;
            case 14:
                this.biteTime = bb.getFloat();
                break;
            case 15:
                this.alcoholicBandage = bb.get() == 1;
                break;
            case 16:
                this.woundInfectionLevel = bb.getFloat();
                break;
            case 17:
                this.infectedWound = bb.get() == 1;
                break;
            case 18:
                this.bleedingTime = bb.getFloat();
                break;
            case 19:
                this.deepWoundTime = bb.getFloat();
                break;
            case 20:
                this.haveGlass = bb.get() == 1;
                break;
            case 21:
                this.stitchTime = bb.getFloat();
                break;
            case 22:
                this.alcoholLevel = bb.getFloat();
                break;
            case 23:
                this.additionalPain = bb.getFloat();
                break;
            case 24:
                this.bandageType = zombie.GameWindow.ReadStringUTF(bb);
                break;
            case 25:
                this.getBandageXp = bb.get() == 1;
                break;
            case 26:
                this.getStitchXp = bb.get() == 1;
                break;
            case 27:
                this.getSplintXp = bb.get() == 1;
                break;
            case 28:
                this.fractureTime = bb.getFloat();
                break;
            case 29:
                this.splint = bb.get() == 1;
                break;
            case 30:
                this.splintFactor = bb.getFloat();
                break;
            case 31:
                this.haveBullet = bb.get() == 1;
                break;
            case 32:
                this.burnTime = bb.getFloat();
                break;
            case 33:
                this.needBurnWash = bb.get() == 1;
                break;
            case 34:
                this.lastTimeBurnWash = bb.getFloat();
                break;
            case 35:
                this.splintItem = zombie.GameWindow.ReadStringUTF(bb);
                break;
            case 36:
                this.plantainFactor = bb.getFloat();
                break;
            case 37:
                this.comfreyFactor = bb.getFloat();
                break;
            case 38:
                this.garlicFactor = bb.getFloat();
                break;
            case 39:
                this.cut = bb.get() == 1;
                break;
            case 40:
                this.cutTime = bb.getFloat();
                break;
            case 41:
                this.stiffness = bb.getFloat();
        }
    }

    public float getCutTime() {
        return this.cutTime;
    }

    public void setCutTime(float _cutTime) {
        _cutTime = Math.min(100.0F, _cutTime);
        this.cutTime = _cutTime;
    }

    public boolean isCut() {
        return this.cut;
    }

    public float getScratchSpeedModifier() {
        return this.scratchSpeedModifier;
    }

    public void setScratchSpeedModifier(float _scratchSpeedModifier) {
        this.scratchSpeedModifier = _scratchSpeedModifier;
    }

    public float getCutSpeedModifier() {
        return this.cutSpeedModifier;
    }

    public void setCutSpeedModifier(float _cutSpeedModifier) {
        this.cutSpeedModifier = _cutSpeedModifier;
    }

    public float getBurnSpeedModifier() {
        return this.burnSpeedModifier;
    }

    public void setBurnSpeedModifier(float _burnSpeedModifier) {
        this.burnSpeedModifier = _burnSpeedModifier;
    }

    public float getDeepWoundSpeedModifier() {
        return this.deepWoundSpeedModifier;
    }

    public void setDeepWoundSpeedModifier(float _deepWoundSpeedModifier) {
        this.deepWoundSpeedModifier = _deepWoundSpeedModifier;
    }

    public boolean isBurnt() {
        return this.getBurnTime() > 0.0F;
    }

    public void generateBleeding() {
        float _float = 0.0F;
        if (this.scratched()) {
            _float = Rand.Next(this.getScratchTime() * 0.3F, this.getScratchTime() * 0.6F);
        }

        if (this.isCut()) {
            _float += Rand.Next(this.getCutTime() * 0.7F, this.getCutTime() * 1.0F);
        }

        if (this.isBurnt()) {
            _float += Rand.Next(this.getBurnTime() * 0.3F, this.getBurnTime() * 0.6F);
        }

        if (this.isDeepWounded()) {
            _float += Rand.Next(this.getDeepWoundTime() * 0.7F, this.getDeepWoundTime());
        }

        if (this.haveGlass()) {
            _float += Rand.Next(5.0F, 10.0F);
        }

        if (this.haveBullet()) {
            _float += Rand.Next(5.0F, 10.0F);
        }

        if (this.bitten()) {
            _float += Rand.Next(7.5F, 15.0F);
        }

        switch (zombie.SandboxOptions.instance.InjurySeverity.getValue()) {
            case 1:
                _float *= 0.5F;
                break;
            case 3:
                _float *= 1.5F;
        }

        _float *= BodyPartType.getBleedingTimeModifyer(BodyPartType.ToIndex(this.getType()));
        this.setBleedingTime(_float);
    }

    public float getInnerTemperature() {
        return this.thermalNode != null ? this.thermalNode.getCelcius() : 0.0F;
    }

    public float getSkinTemperature() {
        return this.thermalNode != null ? this.thermalNode.getSkinCelcius() : 0.0F;
    }

    public float getDistToCore() {
        return this.thermalNode != null ? this.thermalNode.getDistToCore() : BodyPartType.GetDistToCore(this.Type);
    }

    public float getSkinSurface() {
        return this.thermalNode != null ? this.thermalNode.getSkinSurface() : BodyPartType.GetSkinSurface(this.Type);
    }

    public Thermoregulator.ThermalNode getThermalNode() {
        return this.thermalNode;
    }

    public float getWetness() {
        return this.wetness;
    }

    public void setWetness(float _wetness) {
        this.wetness = PZMath.clamp(_wetness, 0.0F, 100.0F);
    }

    public float getStiffness() {
        return this.stiffness;
    }

    public void setStiffness(float _stiffness) {
        this.stiffness = PZMath.clamp(_stiffness, 0.0F, 100.0F);
    }
}
